xenstored: add --master-domid to support domain builder
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Tue, 4 Mar 2014 22:51:34 +0000 (17:51 -0500)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 10 Mar 2014 12:13:50 +0000 (12:13 +0000)
When a domain builder stub domain is used, the initial xenstore
connection to domain 0 may use a different domain ID as the endpoint;
allow this domain ID to be specified on the command line.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_core.h
tools/xenstore/xenstored_domain.c
tools/xenstore/xenstored_minios.c

index 2324e537910383dcca8c9fff25f97d9816d46b8a..47f07229678c7374c0529ef5fedc292728229654 100644 (file)
@@ -1795,6 +1795,7 @@ static struct option options[] = {
        { "entry-nb", 1, NULL, 'E' },
        { "pid-file", 1, NULL, 'F' },
        { "event", 1, NULL, 'e' },
+       { "master-domid", 1, NULL, 'm' },
        { "help", 0, NULL, 'H' },
        { "no-fork", 0, NULL, 'N' },
        { "priv-domid", 1, NULL, 'p' },
@@ -1810,6 +1811,7 @@ static struct option options[] = {
        { NULL, 0, NULL, 0 } };
 
 extern void dump_conn(struct connection *conn); 
+int dom0_domid = 0;
 int dom0_event = 0;
 int priv_domid = 0;
 
@@ -1871,6 +1873,9 @@ int main(int argc, char *argv[])
                case 'e':
                        dom0_event = strtol(optarg, NULL, 10);
                        break;
+               case 'm':
+                       dom0_domid = strtol(optarg, NULL, 10);
+                       break;
                case 'p':
                        priv_domid = strtol(optarg, NULL, 10);
                        break;
index cfbcf6f3c3a7555cd610783aa5da51b2a464918c..dcf95b536d69935d1163502f42edd63af75e7791 100644 (file)
@@ -170,6 +170,7 @@ void trace(const char *fmt, ...);
 void dtrace_io(const struct connection *conn, const struct buffered_data *data, int out);
 
 extern int event_fd;
+extern int dom0_domid;
 extern int dom0_event;
 extern int priv_domid;
 
@@ -177,6 +178,8 @@ extern int priv_domid;
 void *xenbus_map(void);
 void unmap_xenbus(void *interface);
 
+static inline int xenbus_master_domid(void) { return dom0_domid; }
+
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
 
index f24bd6bd188bfcf12a6af63c0b54ca6100248420..f7bbb03c96377e620a27b300dc06245444b34df2 100644 (file)
@@ -606,7 +606,7 @@ static int dom0_init(void)
        if (port == -1)
                return -1;
 
-       dom0 = new_domain(NULL, 0, port); 
+       dom0 = new_domain(NULL, xenbus_master_domid(), port);
        if (dom0 == NULL)
                return -1;
 
index 1c6f794d394e72562cd4d6792bc1d3e505a4be6b..f9c921efc9b8779a1219d986456612d63a53980b 100644 (file)
@@ -51,7 +51,7 @@ evtchn_port_t xenbus_evtchn(void)
 
 void *xenbus_map(void)
 {
-       return xc_gnttab_map_grant_ref(*xcg_handle, 0,
+       return xc_gnttab_map_grant_ref(*xcg_handle, xenbus_master_domid(),
                        GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE);
 }